package com.meteor.downloader.videodownloader.utils.dialog

import android.animation.ObjectAnimator
import android.content.Context
import android.os.Bundle
import androidx.appcompat.app.AppCompatDialog
import com.meteor.downloader.videodownloader.databinding.DialogInitLoadingMdmBinding

class DialogInitMdmLoading(
    private val mContext: Context, private val mContentText: Int? = null
) : AppCompatDialog(mContext) {
    private lateinit var mMdmBinding: DialogInitLoadingMdmBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mMdmBinding = DialogInitLoadingMdmBinding.inflate(layoutInflater)
        setContentView(mMdmBinding.root)

        setCancelable(false)

        mMdmBinding.lavTil1.let {
            ObjectAnimator.ofFloat(it, "rotation", 0f, 360f).apply {
                duration = 1200
                repeatCount = -1
                start()
            }
        }

        mContentText?.let {
            mMdmBinding.tvLoadingContent.text = mContext.getString(it)
        }

        DialogMangerMdmUtils.changeWindowFull(window)
    }
}